package com.atguigu.gmall.order.config;

import org.apache.ibatis.logging.stdout.StdOutImpl;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.*;

/** 自定义线程池
 * @author Jia Fa
 * @create 2021-12-21 18:39
 */
@Configuration
public class ThreadPoolConfig {

    @Bean
    public ExecutorService executorService(){
        return new ThreadPoolExecutor(50, 200, 60, TimeUnit.SECONDS
        ,new ArrayBlockingQueue<>(200), Executors.defaultThreadFactory(),
                (Runnable r, ThreadPoolExecutor executor)->{
                    System.out.println("拒绝策略");
        });
    }
}
